{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 1.形状变换\n",
    "\n",
    "- ndarray.reshape()：改变形状，返回新的矩阵\n",
    "- ndarray.shape=():修改本地矩阵的形状\n",
    "- ndarray.rave() ：把二维矩阵变成一维矩阵\n",
    "- ndarray.transpose():矩阵转置"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a: \n",
      " [ 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14]\n",
      "b: \n",
      " [[ 0  1  2  3  4]\n",
      " [ 5  6  7  8  9]\n",
      " [10 11 12 13 14]]\n",
      "a: \n",
      " [[ 0  1  2  3  4]\n",
      " [ 5  6  7  8  9]\n",
      " [10 11 12 13 14]]\n",
      "a.ravel(): \n",
      " [ 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14]\n",
      "a.transpose(): \n",
      " [[ 0  5 10]\n",
      " [ 1  6 11]\n",
      " [ 2  7 12]\n",
      " [ 3  8 13]\n",
      " [ 4  9 14]]\n"
     ]
    }
   ],
   "source": [
    "a = np.arange(0, 15)\n",
    "print(\"a: \\n\", a)\n",
    "\n",
    "b = a.reshape(3, 5)\n",
    "a.shape = (3, 5)\n",
    "print(\"b: \\n\", b)\n",
    "print(\"a: \\n\", a)\n",
    "\n",
    "print(\"a.ravel(): \\n\", a.ravel())\n",
    "print(\"a.transpose(): \\n\", a.transpose())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
